home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / os2 / gnucal.zip / gcal.h < prev    next >
C/C++ Source or Header  |  1995-12-09  |  25KB  |  658 lines

  1. #ifndef __GCAL_H
  2. #  define __GCAL_H
  3. /*
  4. *  gcal.h:  Program specific macros, typedefs, prototypes...
  5. *
  6. *
  7. *  Copyright (C) 1994, 1995 Thomas Esken
  8. *
  9. *  This software doesn't claim completeness, correctness or usability.
  10. *  On principle I will not be liable for any damages or losses (implicit
  11. *  or explicit), which result from using or handling my software.
  12. *  If you use this software, you agree without any exception to this
  13. *  agreement, which binds you LEGALLY !!
  14. *
  15. *  This program is free software; you can redistribute it and/or modify
  16. *  it under the terms of the `GNU General Public License' as published by
  17. *  the `Free Software Foundation'; either version 2, or (at your option)
  18. *  any later version.
  19. *
  20. *  You should have received a copy of the `GNU General Public License'
  21. *  along with this program; if not, write to the:
  22. *    Free Software Foundation
  23. *    59 Temple Place, Suite 330
  24. *    Boston, MA 02111-1307  USA
  25. */
  26.  
  27.  
  28.  
  29. /*
  30. *  $Id: gcal.h 0.38 1995/12/09 00:03:08 tom Exp $
  31. */
  32.  
  33.  
  34.  
  35. /*
  36. *  Include (sub)header files   ;<
  37. */
  38. #if HAVE_STDIO_H || STDC_HEADERS
  39. #  include <stdio.h>
  40. #endif
  41. #if HAVE_STDLIB_H || STDC_HEADERS
  42. #  include <stdlib.h>
  43. #endif
  44. #if HAVE_STRING_H || STDC_HEADERS
  45. #  include <string.h>
  46. #else /* !HAVE_STRING_H && !STDC_HEADERS */
  47. #  include <strings.h>
  48. #  if !HAVE_STRCHR
  49. #    define strchr       index
  50. IMPORT char *strchr __P_((const char *s, int c));
  51. #  endif /* !HAVE_STRCHR */
  52. #  if !HAVE_STRRCHR
  53. #    define strrchr      rindex
  54. IMPORT char *strrchr __P_((const char *s, int c));
  55. #  endif /* !HAVE_STRRCHR */
  56. #endif
  57. #ifdef __50SERIES
  58. IMPORT char *getenv __P_((const char *env_var));
  59. #endif
  60.  
  61.  
  62. /*
  63. *  Basic preprocessor statements and macros
  64. */
  65. #ifndef NULL
  66. #  define  NULL          0
  67. #endif
  68. #ifndef TRUE
  69. #  define  TRUE          (0==0)
  70. #endif
  71. #ifndef FALSE
  72. #  define  FALSE         (!TRUE)
  73. #endif
  74. #define  LOOP            for(;;)
  75. #if HAVE_VOID
  76. #  define  VOID_PTR      void *
  77. #else /* !HAVE_VOID */
  78. #  define  VOID_PTR      char *
  79. #  define  void          int
  80. #endif /* !HAVE_VOID */
  81. #if !HAVE_STRSTR
  82. #  define  strstr        my_strstr
  83. #endif
  84. #if HAVE_TIME_T
  85. #  define  MY_TIME_T     time_t
  86. #else /* !HAVE_TIME_T */
  87. #  define  MY_TIME_T     long
  88. #endif /* !HAVE_TIME_T */
  89. #if !HAVE_ISDIGIT
  90. #  define  isdigit(gc_c) (((gc_c) >= '0') && ((gc_c) <= '9'))
  91. #endif
  92. #if !HAVE_ISALNUM
  93. #  define  isalnum(gc_c) (   isdigit(gc_c) \
  94.                           || isupper(gc_c) \
  95.                           || islower(gc_c))
  96. #endif
  97. #if !HAVE_UPPER_LOWER
  98. #  define  islower(gc_c) (((gc_c) >= 'a') && ((gc_c) <= 'z'))
  99. #  define  isupper(gc_c) (((gc_c) >= 'A') && ((gc_c) <= 'Z'))
  100. #  define  tolower(gc_c) ((isupper(gc_c)) \
  101.                            ? (gc_c) - 'A' + 'a' \
  102.                            : (gc_c))
  103. #  define  toupper(gc_c) ((islower(gc_c)) \
  104.                            ? (gc_c) - 'a' + 'A' \
  105.                            : (gc_c))
  106. #endif
  107.  
  108.  
  109.  
  110. /*
  111. *  Program specific preprocessor statements
  112. */
  113. #ifndef BUF_LEN
  114. #  define BUF_LEN        16384         /* Maximum length of file block buffer */
  115. #endif
  116. #ifndef MAXLEN
  117. #  define  MAXLEN        1024          /* Maximum length of string text buffer */
  118. #endif
  119. #ifndef MY_ARGC_MAX
  120. #  define  MY_ARGC_MAX   64            /* Default number of command line arguments in `my_argv[]' table */
  121. #endif
  122. #ifndef  EXIT_STAT_HLP
  123. #  define  EXIT_STAT_HLP  0            /* Programs exit status on: help, version, license */
  124. #endif
  125. #define  HD_ELEMS_MAX  100           /* Maximum amount of eternal holidays */
  126. #define  LEN_HD_NAME   29            /* Maximum length of a holiday name inclusive `\0' */
  127. #define  WARN_LVL_MAX  4             /* Maximum amount of debug/warning levels */
  128. /*
  129. *  Preprocessor statements for long options `Lopt_struct' field `symbolic_name'
  130. */
  131. #define  SYM_NIL                    0
  132. #define  SYM_BLOCKS                 1
  133. #define  SYM_CALENDAR_DATES         2
  134. #define  SYM_DEBUG                  3
  135. #define  SYM_DESC_HOLIDAY_LIST      4
  136. #define  SYM_DISABLE_HIGHLIGHTING   5
  137. #define  SYM_EXCLUDE_HD_TITLE       6
  138. #define  SYM_FORCE_HIGHLIGHTING     7
  139. #define  SYM_HELP                   8
  140. #define  SYM_HIGHLIGHTING           9
  141. #define  SYM_HOLIDAY_DATES          10
  142. #define  SYM_HOLIDAY_LIST           11
  143. #define  SYM_LICENSE1               12
  144. #define  SYM_LICENSE2               13
  145. #define  SYM_LICENSE3               14
  146. #define  SYM_LONG_HELP1             15
  147. #define  SYM_LONG_HELP2             16
  148. #define  SYM_MAIL                   17
  149. #define  SYM_RESPONSE_FILE          18
  150. #define  SYM_STARTING_DAY           19
  151. #define  SYM_SUPPRESS_CALENDAR      20
  152. #define  SYM_TYPE_OF_CALENDAR       21
  153. #define  SYM_VERSION                22
  154. #if USE_PAGER
  155. #  define  SYM_PAGER                  100
  156. #endif
  157. #ifdef GCAL_SHELL
  158. #  define  SYM_SCRIPT_FILE            101
  159. #endif
  160. #if USE_RC
  161. #  define  SYM_DATE_VARIABLE1         200
  162. #  define  SYM_DATE_VARIABLE2         201
  163. #  define  SYM_DESC_FIXED_DATES       202
  164. #  define  SYM_EXCLUDE_RC_TITLE       203
  165. #  define  SYM_FIXED_DATES            204
  166. #  define  SYM_GROUPING_TEXT          205
  167. #  define  SYM_HIDDEN                 206
  168. #  define  SYM_INCLUDE_CONS_NO        207
  169. #  define  SYM_INCLUDE_FILENAME       208
  170. #  define  SYM_INCLUDE_HOLIDAY        209
  171. #  define  SYM_INCLUDE_TODAY          210
  172. #  define  SYM_INCLUDE_WEEK_NO        211
  173. #  define  SYM_LIST_MODE              212
  174. #  define  SYM_LIST_OF_FIXED_DATES    213
  175. #  define  SYM_OMIT_DATE_PART         214
  176. #  define  SYM_PERIOD                 215
  177. #  define  SYM_RESOURCE_FILE          216
  178. #endif
  179. /*
  180. *  Preprocessor statements for long options `Lopt_struct' field `larg_mode'
  181. */
  182. #define  LARG_NO         0          /* --foo */
  183. #define  LARG_NO_OR_ONE  1          /* --foo or --foo=BAR */
  184. #define  LARG_ONE        2          /* --foo=BAR */
  185. /*
  186. *  Further preprocessor statements used for long options
  187. */
  188. #define  LARG_MAX        6          /* Maximum number of arguments a long option my have */
  189. #define  LARG_SEP        "="        /* Argument separator of a long option, e.g. --foo=BAR */
  190. #define  LARG_TXT        "ARG"      /* Text of a symbolic long option argument shown if --long-help is given */
  191. /*
  192. *  Further preprocessor statements
  193. */
  194. #if USE_PAGER
  195. #  define  ENV_VAR_LI    "LINES"       /* Name of number of terminal rows environment variable */
  196. #  define  ENV_VAR_CO    "COLUMNS"     /* Name of number of terminal columns environment variable */
  197. #  define  ENV_VAR_LI2   "LI"          /* Name of number of terminal rows environment variable */
  198. #  define  ENV_VAR_CO2   "CO"          /* Name of number of terminal columns environment variable */
  199. #endif
  200. #define  SEP           ":"           /* Separator char of user defined sequences -H<> -v<> */
  201. #define  REM_CHAR      ';'           /* Comment character of a resource/response file line */
  202. #define  RSP_CHAR      '@'           /* Marker character of a response file (@response file) */
  203. #define  QUOTE_CHAR    '\\'          /* Character for quoting NL_CHAR etc. */
  204. #define  SWITCH        "-"           /* Default switch char, which defines an command line option */
  205. #define  SWITCH2       "/"           /* First additional switch char */
  206. #define  MLIST_SEP     ","           /* Separator of a month list (mm,mm) */
  207. #define  MRANGE_SEP    "-"           /* Separator of a month range (mm-mm) */
  208. #define  YLIST_SEP     ";"           /* Separator of a year list (yyyy;yyyy) */
  209. #define  YRANGE_SEP    "+"           /* Separator of a year range (yyyy+yyyy) */
  210. #define  YEAR_SEP      "/"           /* Separator of a standard year (mm/yyyy) */
  211. #define  FYEAR_SEP     ":"           /* Separator of a fiscal year (mm:yyyy) */
  212. #define  MONTH3_LIT    "."           /* Command for enabling 3-month mode (.|..|.+|.-) */
  213. #define  DIS_HLS_PREF  "*"           /* Prefix to disable highlighting of a holiday */
  214. #define  TIME_SEP      ":"           /* Time separator hh:mm */
  215. #define  ASC_LIT       "+"           /* Modifier for going ascending/forwards in date */
  216. #define  DES_LIT       "-"           /* Modifier for going descending/backwards in date */
  217. #define  S_OUT_ROWS    3             /* Number of standard calsheet format default rows standard date */
  218. #define  S_OUT_COLS    4             /* Number of standard calsheet format default columns standard date */
  219. #define  J_OUT_ROWS    4             /* Number of standard calsheet format default rows Julian date */
  220. #define  J_OUT_COLS    3             /* Number of standard calsheet format default columns Julian date */
  221. #define  B_OUT_ROWS    12            /* Number of standard calsheet format default rows both dates */
  222. #define  B_OUT_COLS    1             /* Number of standard calsheet format default columns both dates */
  223. #define  SI_OUT_ROWS   4             /* Number of special calsheet format default rows standard date */
  224. #define  SI_OUT_COLS   3             /* Number of special calsheet format default columns standard date */
  225. #define  JI_OUT_ROWS   6             /* Number of special calsheet format default rows Julian date */
  226. #define  JI_OUT_COLS   2             /* Number of special calsheet format default columns Julian date */
  227. #define  BI_OUT_ROWS   B_OUT_ROWS    /* Number of special calsheet format default rows both dates */
  228. #define  BI_OUT_COLS   B_OUT_COLS    /* Number of special calsheet format default columns both dates */
  229. #if USE_RC
  230. #  define  A2_OUT_ROWS   1             /* No of default 2-month mode rows Julian and standard dates */
  231. #  define  A2_OUT_COLS   2             /* No of default 2-month mode columns Julian and standard dates */
  232. #  define  B2_OUT_ROWS   2             /* No of default 2-month mode rows both dates */
  233. #  define  B2_OUT_COLS   1             /* No of default 2-month mode columns both dates */
  234. #endif
  235. #define  S3_OUT_ROWS   1             /* No of standard calsheet format default 3-month mode rows standard date */
  236. #define  S3_OUT_COLS   3             /* No of standard calsheet format default 3-month mode columns standard date */
  237. #define  J3_OUT_ROWS   S3_OUT_ROWS   /* No of standard calsheet format default 3-month mode rows Julian date */
  238. #define  J3_OUT_COLS   S3_OUT_COLS   /* No of standard calsheet format default 3-month mode columns Julian date */
  239. #define  B3_OUT_ROWS   3             /* No of standard calsheet format default 3-month mode rows both dates */
  240. #define  B3_OUT_COLS   1             /* No of standard calsheet format default 3-month mode columns both dates */
  241. #define  SI3_OUT_ROWS  S3_OUT_ROWS   /* No of special calsheet format default 3-month mode rows standard date */
  242. #define  SI3_OUT_COLS  S3_OUT_COLS   /* No of special calsheet format default 3-month mode columns standard date */
  243. #define  JI3_OUT_ROWS  B3_OUT_ROWS   /* No of special calsheet format default 3-month mode rows Julian date */
  244. #define  JI3_OUT_COLS  B3_OUT_COLS   /* No of special calsheet format default 3-month mode columns Julian date */
  245. #define  BI3_OUT_ROWS  B3_OUT_ROWS   /* No of special calsheet format default 3-month mode rows both dates */
  246. #define  BI3_OUT_COLS  B3_OUT_COLS   /* No of special calsheet format default 3-month mode columns both dates */
  247. #define  CENTURY       1900          /* Operating system standard starting century, DON'T change ! */
  248. /*
  249. *  Set preprocessor symbols to requested period of Gregorian reformation
  250. */
  251. #ifdef GREG_1582
  252. #  if !GREG_1582
  253. #    undef GREG_1582
  254. #  endif
  255. #endif
  256. #ifdef GREG_1752
  257. #  if !GREG_1752
  258. #    undef GREG_1752
  259. #  endif
  260. #endif
  261. #if GREG_1582 && GREG_1752
  262. #  undef GREG_1582
  263. #  undef GREG_1752
  264. #endif
  265. #if !GREG_1582 && !GREG_1752
  266. #  if USE_GER
  267. #    ifdef GREG_1582
  268. #      undef GREG_1582
  269. #    endif
  270. #    define GREG_1582  1
  271. #  else /* !USE_GER */
  272. #    ifdef GREG_1752
  273. #      undef GREG_1752
  274. #    endif
  275. #    define GREG_1752  1
  276. #  endif /* !USE_GER */
  277. #endif
  278. #define  GREG_REFORM   1582          /* Real year of Gregorian reformation */
  279. #if GREG_1582
  280. #  define  GREG_YEAR   GREG_REFORM     /* Year of Gregorian reformation in most parts of germany */
  281. #  define  GREG_MONTH  10              /* Month of ... */
  282. #  define  GREG_F_DAY  5               /* First missing day/date in oct 1582 */
  283. #  define  GREG_L_DAY  14              /* Last missing day/date ... */
  284. #endif
  285. #if GREG_1752
  286. #  define  GREG_YEAR   1752            /* Year of Gregorian reformation in most parts of uk/usa */
  287. #  define  GREG_MONTH  9               /* Month of ... */
  288. #  define  GREG_F_DAY  3               /* First missing day/date in sep 1752 */
  289. #  define  GREG_L_DAY  13              /* Last missing day/date ... */
  290. #endif
  291. /*
  292. *  Language dependent preprocessor statements
  293. */
  294. #if USE_GER
  295. #  define  USAGE       "Aufruf: "
  296. #  define  Y_LIT       "jj"
  297. #  if USE_PAGER
  298. #    define  PAGER_QUIT  "q"             /* Quits the internal pager */
  299. #  endif
  300. #  define  HD_LIST_TITLE "Ewige Feiertagsliste"
  301. #  define  RESPONSE_TXT  "Antwortdatei"
  302. #  ifdef GCAL_SHELL
  303. #    define  SCRIPT_TXT    "shell script"
  304. #  endif
  305. #else /* !USE_GER */
  306. #  define  USAGE       "Usage:  "
  307. #  define  Y_LIT       "yy"
  308. #  if USE_PAGER
  309. #    define  PAGER_QUIT  "q"             /* Quits the internal pager */
  310. #  endif
  311. #  define  HD_LIST_TITLE "Eternal holiday list"
  312. #  define  RESPONSE_TXT  "response file"
  313. #  ifdef GCAL_SHELL
  314. #    define  SCRIPT_TXT    "shell script"
  315. #  endif
  316. #endif /* !USE_GER */
  317. #define  Y_LIT2      Y_LIT""Y_LIT    /* Metatext for year */
  318. #define  DAY_LAST    365             /* Last day in a NON leap year */
  319. #define  DAY_MIN     1               /* Minimum day of week/month/year */
  320. #define  DAY_MAX     7               /* Maximum day/amount of days of week */
  321. #define  WEEK_MAX    52              /* Maximum week number of year */
  322. #define  MONTH_MIN   1               /* Minimum month of year */
  323. #define  MONTH_MAX   12              /* Maximum month of year */
  324. #define  YEAR_MIN    1               /* Minimum year able to compute */
  325. #define  YEAR_MAX    9999            /* Maximum year able to compute */
  326. #define  EASTER_MIN  463+1           /* Minimum year for computing Easter Sunday */
  327. #define  EASTER_MAX  YEAR_MAX        /* Maximum year for computing Easter Sunday */
  328. #define  MONTH_COLS  6               /* Maximum number of columns of a month */
  329. #define  VEC_BLOCK   42              /* Maximum number of elements per month (7*6) */
  330. #define  VEC_ELEMS   504             /* Maximum number of elements per year (42*12) */
  331. /*
  332. *  Fixed date warnings/resource file specific preprocessor statements
  333. */
  334. #if USE_RC
  335. #  ifndef RC_ELEMS_MAX
  336. #    define  RC_ELEMS_MAX       1024      /* Default number of `rc_table[]' entries */
  337. #  endif
  338. #  define  RC_DVAR_MAX        26        /* Maximum number of date variables */
  339. #  define  RC_ADATE_CHAR      '%'       /* Leading char of modified actual date %... */
  340. #  define  RC_HDY_CHAR        '@'       /* RC-file holiday/date-variable prefix in date part */
  341. #  define  RC_NWD_CHAR        '*'       /* RC-file n'th weekday prefix in date part */
  342. #  define  RC_EASTER_CHAR     'e'       /* Leading char of a @easter date part */
  343. #  define  RC_NL_CHAR         '~'       /* Inserts a real newline \n if found */
  344. #  define  RC_MACRO_CHAR      '%'       /* RC-file macro prefix */
  345. #  define  RC_BYEAR_CHAR      'b'       /* Leading char of a %birthyear macro */
  346. #  define  RC_SDATE_CHAR      's'       /* Leading char of a %starting date macro */
  347. #  define  RC_EDATE_CHAR      'e'       /* Leading char of a %ending date macro */
  348. #  define  RC_TIME_CHAR       't'       /* Leading char of a %time macro */
  349. #  define  RC_DAY_CHAR        'd'       /* Leading char of a %day macro */
  350. #  define  RC_WEEK_CHAR       'w'       /* Leading char of a %week macro */
  351. #  define  RC_MONTH_CHAR      'm'       /* Leading char of a %month macro */
  352. #  define  RC_YEAR_CHAR       'y'       /* Leading char of a %year macro */
  353. #  define  RC_DATE_CHAR       'n'       /* Leading char of a %effective date macro */
  354. #  define  RC_FNAME_SEP       "+"       /* Additional RC-file list separator -f|F<NAME[+NAME+...]>*/
  355. #  define  RC_DVAR_ASSIGN     "="       /* Assignment operator of a date variable (var=mmdd) */
  356. #  define  RC_DVAR_ADD        "+"       /* Add operator of a date variable (var++ | var+=<n>) */
  357. #  define  RC_DVAR_SUB        "-"       /* Subtract operator of a date variable (var-- | var-=<n>) */
  358. #  define  RC_GROUP_SEP       ""        /* Default grouping `txt' of fixed date list [-c]g */
  359. #  define  RC_AM_TXT          "am"      /* Trailing "after midnight" text of %time12 macro */
  360. #  define  RC_PM_TXT          "pm"      /* Trailing "past midnight" text of %time12 macro */
  361. #  define  RC_INCL_STMENT     "#include"         /* Name of RC-file include statement (upper) */
  362. #  define  RC_INCL_USR_ID     "\""               /* User include file name starts with */
  363. #  define  RC_INCL_USR_OD     RC_INCL_USR_ID     /* User include file name ends with */
  364. #  define  RC_INCL_SYS_ID     "<"                /* System include file name start with */
  365. #  define  RC_INCL_SYS_OD     ">"                /* System include file name ends with */
  366. #  define  ENV_VAR_USR_LIBDIR "GCAL_USR_LIBDIR"  /* Environment variable name of user lib dir */
  367. #  define  ENV_VAR_SYS_LIBDIR "GCAL_SYS_LIBDIR"  /* Environment variable name of system lib dir */
  368. #  if USE_GER
  369. #    define  RC_LIST_TITLE      "Terminliste"      /* Title of fixed date list */
  370. #    define  RC_INTERNAL_TXT    "Intern"           /* */
  371. #  else /* !USE_GER */
  372. #    define  RC_LIST_TITLE      "Fixed date list"  /* Title of fixed date list */
  373. #    define  RC_INTERNAL_TXT    "Internal"         /* */
  374. #  endif /* !USE_GER */
  375. #  define  USAGE_RC1          " c f"          /* Additional usage text */
  376. #  define  USAGE_RC2          " v"            /* Additional usage text */
  377. #else /* !USE_RC */
  378. #  define  USAGE_RC1          ""
  379. #  define  USAGE_RC2          ""
  380. #endif /* !USE_RC */
  381. #if USE_PAGER
  382. #  define  USAGE_PAGER        " p"            /* Additional usage text */
  383. #else /* !USE_PAGER */
  384. #  define  USAGE_PAGER        ""
  385. #endif /* !USE_PAGER */
  386. #ifdef GCAL_EMAIL
  387. #  define USAGE_MAIL          " m"            /* Additional usage text */
  388. #else /* !GCAL_EMAIL */
  389. #  define USAGE_MAIL          ""
  390. #endif /* !GCAL_EMAIL */
  391. #ifdef GCAL_SHELL
  392. #  define USAGE_SHELL         " S"            /* Additional usage text */
  393. #else /* !GCAL_SHELL */
  394. #  define USAGE_SHELL         ""
  395. #endif /* !GCAL_SHELL */
  396. /*
  397. *  Now define the usage text
  398. */
  399. #define  USAGE_MSG  USAGE"%s ["SWITCH"|"SWITCH2"{[h|hh|L|V]|" \
  400.                     "{H R"USAGE_SHELL" X b"USAGE_RC1" i j"USAGE_MAIL \
  401.                     " n"USAGE_PAGER" s u"USAGE_RC2"}}]  [[mm] ["Y_LIT2"]]"
  402.   
  403.  
  404. /*
  405. *  And last but not least...
  406. */
  407. #define  COPYRIGHT_TXT  "Copyright (C) 1994, 1995 Thomas Esken"
  408.  
  409.  
  410. /*
  411. *  Common preprocessor macros
  412. */
  413. #define  S_NEWLINE(gc_fp)    fputc('\n', (gc_fp))
  414. #if USE_RC
  415. #  define IDX(gc_ch)         (tolower((gc_ch)) - 'a')
  416. #endif
  417. #define  MY_ISSPACE(gc_ch)   ((   (gc_ch) == ' ' \
  418.                                || (gc_ch) == '\f' \
  419.                                || (gc_ch) == '\n' \
  420.                                || (gc_ch) == '\r' \
  421.                                || (gc_ch) == '\t' \
  422.                                || (gc_ch) == '\v') \
  423.                                ? TRUE \
  424.                                : FALSE)
  425. #define  SYEAR(gc_d, gc_s)   (((gc_d)-(gc_s)+1) < DAY_MIN) \
  426.                                ? ((gc_d)-(gc_s)+(DAY_MAX+1)) \
  427.                                : ((gc_d)-(gc_s)+1)
  428. #define  SMONTH(gc_d, gc_s)  (((gc_d)+(gc_s)-1) > MONTH_MAX) \
  429.                                ? ((gc_d)+(gc_s)-(MONTH_MAX+1)) \
  430.                                : ((gc_d)+(gc_s)-1)
  431. #define  SDAY(gc_d, gc_s)    (((gc_d)+(gc_s)-1) > DAY_MAX) \
  432.                                ? ((gc_d)+(gc_s)-(DAY_MAX+1)) \
  433.                                : ((gc_d)+(gc_s)-1)
  434.  
  435.  
  436.  
  437. #ifdef CUT_LONGNAMES
  438. /*
  439. *  Cut resp., replace some long variable or function names to 6 significant
  440. *    places so ANY linker should be able to bind an executable file
  441. */
  442. #  define compare_d_m_name             F_cdm
  443. #  define comparemode                  V_cm
  444. #  if !USE_RC
  445. #    define days_of_feb                  V_dof
  446. #  endif
  447. #  define days_of_february             F_dof
  448. #  if USE_HLS || USE_PAGER
  449. #    define get_termcap_hls              F_ghl
  450. #    define get_termcap_scr_attrib       F_gsc
  451. #  endif
  452. #  define get_tty_hls                  F_gth
  453. #  if USE_PAGER
  454. #    define get_tty_scr_size             F_gts
  455. #  endif
  456. #  define hd_title_flag                V_htf
  457. #  define hd_title_shown               V_hts
  458. #  define holiday_flag                 V_hf
  459. #  define holiday_name                 V_hn
  460. #  define holiday_prefix               V_hp
  461. #  define holiday_vector               V_hv
  462. #  define is_3month_mode               V_3m
  463. #  define is_3month_mode2              V_3m2
  464. #  define is_ext_list                  V_iel
  465. #  define is_ext_range                 V_ier
  466. #  define is_ext_year                  V_iey
  467. #  define is_tty                       V_it
  468. #  define is_tty1                      V_it1
  469. #  define is_tty2                      V_it2
  470. #  define julian_days                  V_jd
  471. #  define julian_flag                  V_jf
  472. #  define julian_vector                V_jv
  473. #  define longopt                      V_lo
  474. #  define longopt_symbolic             V_los
  475. #  define module_line                  V_mdl
  476. #  define module_name                  V_mdn
  477. #  define month_list                   V_ml
  478. #  define month_name                   F_mn
  479. #  define month_set                    V_ms
  480. #  define my_argc                      V_mac
  481. #  define my_argc_max                  V_max
  482. #  define my_argv                      V_mav
  483. #  define my_help_head_txt             F_mhh
  484. #  define my_help_tail_txt             F_mht
  485. #  if USE_RC
  486. #    define precomp_date                 F_pd
  487. #    define precomp_nth_wd               F_pwd
  488. #  endif
  489. #  define print_all_holidays           F_pah
  490. #  define print_calendar               F_pc
  491. #  define print_highlighted_date       F_phd
  492. #  if USE_HLS
  493. #    define print_hls                    V_phl
  494. #  endif
  495. #  if USE_RC
  496. #    define print_line                   V_pl
  497. #  endif
  498. #  define print_single_date            F_psd
  499. #  define print_single_holiday         F_psh
  500. #  define print_text                   F_ptx
  501. #  if USE_RC
  502. #    define print_twice                  V_ptw
  503. #    define rc_elems                     V_re
  504. #    define rc_elems_max                 V_rem
  505. #    define rc_enable_fn_flag            V_rfn
  506. #    define rc_enable_hda_flag           V_rha
  507. #    define rc_enable_hdl_flag           V_rhl
  508. #    define rc_period                    V_rp
  509. #    define rc_period_flag               V_rpf
  510. #    define rc_period_list               V_rpl
  511. #    if HAVE_ASSERT_H
  512. #      define rc_table_range_checked       V_rrc
  513. #    endif
  514. #    define rc_table_initialized         V_ri
  515. #    define rc_use                       F_ru
  516. #    define rc_use_flag                  V_ruf
  517. #    define rc_week_flag                 V_rwf
  518. #    define rc_weekno_flag               V_rwn
  519. #    define rc_week_year_flag            V_rwy
  520. #  endif
  521. #  define short_day_name               F_sdn
  522. #  define short_month_name             F_smn
  523. #endif /* CUT_LONGNAMES */
  524.  
  525.  
  526.  
  527. /*
  528. *  Type definitions
  529. */
  530. typedef
  531.   unsigned char
  532.   Uchar;
  533. typedef
  534.   unsigned int
  535.   Uint;
  536. typedef
  537. #if __STDC__
  538.   signed long int
  539. #else /* !__STDC__ */
  540.   long
  541. #endif /* !__STDC__ */
  542.   Slint;
  543. typedef
  544. #if __STDC__
  545.   unsigned long int
  546. #else /* !__STDC__ */
  547.   unsigned long
  548. #endif /* !__STDC__ */
  549.   Ulint;
  550. typedef
  551.   char
  552.   Bool;
  553. /*
  554. *  (quick)sort function type
  555. */
  556. typedef
  557.   int
  558.   (*Func_cmp)(const VOID_PTR, const VOID_PTR);
  559. /*
  560. *  The long option record
  561. */
  562. typedef
  563.   struct long_option_type
  564.    {
  565.      int    symbolic_name;
  566.      char  *long_name;
  567.      char  *short_name[LARG_MAX];
  568.      int    larg_mode;
  569.      char  *largs[LARG_MAX];
  570.    }
  571.   Lopt_struct;
  572. /*
  573. *  The highlighting sequence record
  574. */
  575. typedef
  576.   struct   hls_type
  577.    {
  578.      const char  *seq;
  579.            int    len;
  580.    }
  581.   Hls_struct;
  582. #if USE_RC
  583. /*
  584. *  The date variable records
  585. */
  586. typedef
  587.   struct  dvar_base_type
  588.    {
  589.      char  month;
  590.      char  day;
  591.    }
  592.   Dvar_base_struct;
  593. typedef
  594.   struct  dvar_type
  595.    {
  596.      Dvar_base_struct  g;   /* globals */
  597.      Dvar_base_struct  l;   /* locals */
  598.    }
  599.   Dvar_struct;
  600. #endif /* USE_RC */
  601. /*
  602. *  The month/year list/range record
  603. */
  604. typedef
  605.   struct  ml_type
  606.    {
  607.      int  month[MONTH_MAX+1];
  608.      int  year[MONTH_MAX+1];
  609.    }
  610.   Ml_struct;
  611. /*
  612. *  General purpose enumerations types
  613. */
  614. typedef
  615.   enum compare_mode
  616.    {
  617.        DAy=1,
  618. #if USE_RC
  619.        DVar,
  620.        EAster,
  621.        WEek,
  622. #endif
  623.        MOnth
  624.    }
  625.   Cmode_enum;
  626. typedef
  627.   enum display_mode
  628.    {
  629.        CAlendar=1,
  630.        INternal
  631.    }
  632.   Dmode_enum;
  633. typedef
  634.   enum file_mode
  635.    {
  636.        REsponse=1,
  637. #if USE_RC
  638.        USr_include,
  639.        SYs_include,
  640.        REsource,
  641. #endif
  642. #ifdef GCAL_SHELL
  643.        SCript,
  644. #endif
  645.        COmmon
  646.    }
  647.   Fmode_enum;
  648. #if USE_RC
  649. typedef
  650.   enum dvar_mode
  651.    {
  652.        GLobal=1,
  653.        LOcal
  654.    }
  655.   Dvar_enum;
  656. #endif
  657. #endif /* __GCAL_H */
  658.